package homework.jdbc.dao;
import java.sql.*;
import java.util.Scanner;

public class JDBCUtils {
        private static Connection conn=null;
        public static Connection getConnection(){
            /*
            Scanner s=new Scanner(System.in);
            System.out.print("user:");
            String user=s.nextLine();
            System.out.print("password:");
            String password=s.nextLine();
            */
            try{
                Class.forName("com.mysql.jdbc.Driver");
                conn=DriverManager.getConnection("jdbc:mysql://localhost:3307/user","root","123456");
                return conn;
            }catch(Exception e){
                e.printStackTrace();
            }
            return null;
        }
        public static void close(){
            try{
                conn.close();
            }catch(SQLException e){
                e.printStackTrace();
            }
        }
}
